import moment from 'moment';


/**
 *  {
        label: "账号",
        name:  "字段名",
        rules: [{ required: true, message: '请输入账号' }],
        className: "publish-quill",
        form: {
            type: "Input",
            placeholder: "请输入账号",
            style: { width: 400 }
        }
    }
 */


const users = [
    {
        label: "账号",
        name: "username",
        rules: [{ required: true, message: '请输入账号' }],
        form: {
            type: "Input",
            placeholder: "请输入账号",
            style: { width: 400 }
        }
    },
    // {
    //     label: "密码",
    //     name: "password",
    //     rules: [{ required: true, message: '请输入密码' }],
    //     form: {
    //         type: "Input.Password",
    //         placeholder: "请输入密码",
    //         style: { width: 400 }
    //     }
    // },
    // {
    //     label: "确认密码",
    //     name: "repassword",
    //     rules: [{ required: true, message: '请再次输入密码' }],
    //     form: {
    //         type: "Input.Password",
    //         placeholder: "请再次输入密码",
    //         style: { width: 400 }
    //     }
    // },
    {
        label: "姓名",
        name: "realname",
        rules: [{ required: true, message: '请输入姓名' }],
        form: {
            type: "Input",
            placeholder: "请输入姓名"
        }
    },
    {
        label: "是否可用",
        name: "enabled",
        form: {
            type: "Radio",
            optionType: "button",  //用于设置 Radio options 类型	default | button
            buttonStyle: "solid",  //RadioButton 的风格样式 outline | solid
            values: [
                        {label: "是", value: 1},
                        {label: "否", value: 0},
                        {label: '未知', value: '2', disabled: true },
                    ],
            defaultValue: 1
        }
    },
    {
        label: "部门",
        name: "dept_code",
        form: {
            type: "Select",
            placeholder: "请选择部门",
            label: "dept_name",
            value: "dept_code",
            api: "department"

        }
    }
  ]

const article = [
    {
        label: "标题",
        name: "title",
        rules: [{ required: true, message: '请输入文章标题' }],
        form: {
            type: "Input",
            placeholder: "请输入文章标题"
        }
    },
    {
        label: "封面",
        name: "type",
        form: {
            type:  "Upload",
            action: "/api/upload", // 上传接口
            count: 100 // 上传数量限制
        }


    },
    {
        label: "内容",
        name: "content",
        rules: [{ required: true, message: '请输入文章内容' }],
        className: "publish-quill",
        form: {
            type: "ReactQuill"
        }
    },
    {
        label: "创建时间",
        name: "create_at",
        form: {
            type: "DatePicker",
            style: { width: 400 },
            format: "YYYY-MM-DD HH:mm:ss", 
            showTime: { defaultValue: moment('00:00:00', 'HH:mm:ss')}
        }
    },
    {
        label: "更新时间",
        name: "update_at",
        form: {
            type: "DatePicker",
            style: { width: 400 },
            format: "YYYY-MM-DD HH:mm:ss", 
            showTime: { defaultValue: moment('00:00:00', 'HH:mm:ss')}
        }
    }
]


const question_bank = [
    {
        label: "课程",
        name: "course_code",
        // rules: [{ required: true, message: '请选择课程' }],
        form: {
            type: "Select",
            placeholder: "请选择课程",
            label: "name",
            value: "code",
            api: "course",
            style: { width: 400 }

        }
    },
    {
        label: "题型",
        name: "subject_type",
        form: {
            type: "Radio",
            optionType: "button",  //用于设置 Radio options 类型	default | button
            buttonStyle: "solid",  //RadioButton 的风格样式 outline | solid
            defaultValue: "single",
            values: [
                        {label: "单选题", value: "single"},
                        {label: "多选题", value: "multiple"},
                        {label: '问答题', value: "questions"},
                    ],
            defaultValue: "single"
        }
    },
    {
        label: "题目",
        name: "subject",
        rules: [{ required: true, message: '请输入题目' }],
        form: {
            type: "Input",
            placeholder: "请输入题目",
            style: { width: 400 }
        }
    },
    {
        label: "选项A",
        name: "optionA",
        // rules: [{ required: true, message: '请输入选项A' }],
        form: {
            type: "Input",
            placeholder: "选项A",
            style: { width: 400 }
        }
    },
    {
        label: "选项B",
        name: "optionB",
        // rules: [{ required: true, message: '请输入选项B' }],
        form: {
            type: "Input",
            placeholder: "选项B",
            style: { width: 400 }
        }
    },
    {
        label: "选项C",
        name: "optionC",
        // rules: [{ required: true, message: '请输入选项C' }],
        form: {
            type: "Input",
            placeholder: "选项C",
            style: { width: 400 }
        }
    },
    {
        label: "选项D",
        name: "optionD",
        // rules: [{ required: true, message: '请输入选项D' }],
        form: {
            type: "Input",
            placeholder: "选项D",
            style: { width: 400 }
        }
    },
    {
        label: "答案",
        name: "answer",
        rules: [{ required: true, message: '请输入答案' }],
        form: {
            type: "Input",
            placeholder: "答案",
            style: { width: 400 }
        }
    },
    {
        label: "难度等级",
        name: "difficulty_level",
        form: {
            type: "Radio",
            optionType: "button",  //用于设置 Radio options 类型	default | button
            buttonStyle: "solid",  //RadioButton 的风格样式 outline | solid
            values: [
                        {label: "简单", value: "simple" },
                        {label: "一般", value: "general"},
                        {label: '复杂', value: "complex"},
                    ],
            defaultValue: "simple"
        }
    },
    {
        label: "描述",
        name: "remark",
        form: {
            type: "TextArea",
            rows: 4
        }
    }
  ]

  const student = [
    {
        label: "学号",
        name: "student_no",
        rules: [{ required: true, message: '请输入学号' }],
        form: {
            type: "Input",
            placeholder: "学号",
            style: { width: 400 }
        }
    },
    {
        label: "姓名",
        name: "name",
        rules: [{ required: true, message: '请输入姓名' }],
        form: {
            type: "Input",
            placeholder: "姓名",
            style: { width: 400 }
        }
    },
    {
        label: "性别",
        name: "gender",
        form: {
            type: "Radio",
            optionType: "button",  //用于设置 Radio options 类型	default | button
            buttonStyle: "solid",  //RadioButton 的风格样式 outline | solid
            values: [
                        {label: "男", value: "男" },
                        {label: "女", value: "女"}
                    ],
            defaultValue: "男"
        }
    },
    {
        label: "学院",
        name: "college_code",
        // rules: [{ required: true, message: '请选择学院' }],
        form: {
            type: "Select",
            placeholder: "学院",
            label: "name",
            value: "code",
            api: "college",
            style: { width: 400 }

        }
    },
    {
        label: "专业",
        name: "specialty_code",
        // rules: [{ required: true, message: '请选择专业' }],
        form: {
            type: "Select",
            placeholder: "专业",
            label: "name",
            value: "code",
            api: "specialty",
            style: { width: 400 }

        }
    },
    {
        label: "邮箱",
        name: "email",
        rules: [{ required: true, message: '请输入邮箱' }],
        form: {
            type: "Input",
            placeholder: "邮箱",
            style: { width: 400 }
        }
    },
    {
        label: "出生日期",
        name: "birthday",
        rules: [{ required: true, message: '请选择出生日期' }],
        form: {
            type: "DatePicker",
            style: { width: 400 },
            format: "YYYY-MM-DD"
        }
    }
  ]

  const teacher = [
    {
        label: "工号",
        name: "teacher_no",
        rules: [{ required: true, message: '请输入工号' }],
        form: {
            type: "Input",
            placeholder: "工号",
            style: { width: 400 }
        }
    },
    {
        label: "姓名",
        name: "name",
        rules: [{ required: true, message: '请输入姓名' }],
        form: {
            type: "Input",
            placeholder: "姓名",
            style: { width: 400 }
        }
    },
    {
        label: "性别",
        name: "gender",
        form: {
            type: "Radio",
            optionType: "button",  //用于设置 Radio options 类型	default | button
            buttonStyle: "solid",  //RadioButton 的风格样式 outline | solid
            values: [
                        {label: "男", value: "男" },
                        {label: "女", value: "女"}
                    ],
            defaultValue: "男"
        }
    },
    {
        label: "学院",
        name: "college_code",
        // rules: [{ required: true, message: '请选择学院' }],
        form: {
            type: "Select",
            placeholder: "学院",
            label: "name",
            value: "code",
            api: "college",
            style: { width: 400 }

        }
    },
    {
        label: "邮箱",
        name: "email",
        rules: [{ required: true, message: '请输入邮箱' }],
        form: {
            type: "Input",
            placeholder: "邮箱",
            style: { width: 400 }
        }
    },
    {
        label: "出生日期",
        name: "birthday",
        rules: [{ required: true, message: '请选择出生日期' }],
        form: {
            type: "DatePicker",
            style: { width: 400 },
            format: "YYYY-MM-DD"
        }
    }
  ]

  const manager = [
    {
        label: "帐号",
        name: "account",
        rules: [{ required: true, message: '请输入帐号' }],
        form: {
            type: "Input",
            placeholder: "帐号",
            style: { width: 400 }
        }
    },
    {
        label: "姓名",
        name: "name",
        rules: [{ required: true, message: '请输入姓名' }],
        form: {
            type: "Input",
            placeholder: "姓名",
            style: { width: 400 }
        }
    },
    {
        label: "邮箱",
        name: "email",
        rules: [{ required: true, message: '请输入邮箱' }],
        form: {
            type: "Input",
            placeholder: "邮箱",
            style: { width: 400 }
        }
    }
  ]

  const college = [
    {
        label: "学院名称",
        name: "name",
        rules: [{ required: true, message: '请输入名称' }],
        form: {
            type: "Input",
            placeholder: "名称",
            style: { width: 400 }
        }
    },
    {
        label: "学院编码",
        name: "code",
        rules: [{ required: true, message: '请输入编码' }],
        form: {
            type: "Input",
            placeholder: "编码",
            style: { width: 400 }
        }
    }
  ]

  const specialty = [
    {
        label: "专业名称",
        name: "name",
        rules: [{ required: true, message: '请输入名称' }],
        form: {
            type: "Input",
            placeholder: "名称",
            style: { width: 400 }
        }
    },
    {
        label: "专业编码",
        name: "code",
        rules: [{ required: true, message: '请输入编码' }],
        form: {
            type: "Input",
            placeholder: "编码",
            style: { width: 400 }
        }
    }
  ]

  const course = [
    {
        label: "课程名称",
        name: "name",
        rules: [{ required: true, message: '请输入名称' }],
        form: {
            type: "Input",
            placeholder: "名称",
            style: { width: 400 }
        }
    },
    {
        label: "课程编码",
        name: "code",
        rules: [{ required: true, message: '请输入编码' }],
        form: {
            type: "Input",
            placeholder: "编码",
            style: { width: 400 }
        }
    }
  ]

  const exam_paper = [
    {
        label: "试卷名称",
        name: "name",
        rules: [{ required: true, message: '请输入题目' }],
        form: {
            type: "Input",
            placeholder: "请输入题目",
            style: { width: 400 }
        }
    },
    {
        label: "总分值",
        name: "score",
        rules: [{required: true, type: 'number', min: 0, max: 150, message: '请输入总分值!'},],
        form: {
            type: "InputNumber",
            placeholder: "请输入总分值",
            style: { width: 400 }
        }
    },
    {
        label: "课程",
        name: "course_code",
        form: {
            type: "Select",
            placeholder: "请选择课程",
            label: "name",
            value: "code",
            api: "course",
            style: { width: 400 }

        }
    },
    {
        label: "单选题数量",
        name: "single_num",
        rules: [{required: true, type: 'number', min: 0, max: 100, message: '请输入数量!'},],
        form: {
            type: "InputNumber",
            placeholder: "请输入数量",
            style: { width: 400 }
        }
    },
    {
        label: "单选题分值（题）",
        name: "single_score",
        rules: [{required: true, type: 'number', min: 0, max: 100, message: '请输入分值!'},],
        form: {
            type: "InputNumber",
            placeholder: "请输入分值（题）",
            style: { width: 400 }
        }
    },
    {
        label: "多选题数量",
        name: "multiple_num",
        rules: [{required: true, type: 'number', min: 0, max: 100, message: '请输入数量!'},],
        form: {
            type: "InputNumber",
            placeholder: "请输入数量",
            style: { width: 400 }
        }
    },
    {
        label: "多选题分值（题）",
        name: "multiple_score",
        rules: [{required: true, type: 'number', min: 0, max: 100, message: '请输入分值!'},],
        form: {
            type: "InputNumber",
            placeholder: "请输入分值（题）",
            style: { width: 400 }
        }
    },
    {
        label: "问答题数量",
        name: "questions_num",
        rules: [{required: true, type: 'number', min: 0, max: 100, message: '请输入数量!'},],
        form: {
            type: "InputNumber",
            placeholder: "请输入数量",
            style: { width: 400 }
        }
    },
    {
        label: "问答题分值（题）",
        name: "questions_score",
        rules: [{required: true, type: 'number', min: 0, max: 100, message: '请输入分值!'},],
        form: {
            type: "InputNumber",
            placeholder: "请输入分值（题）",
            style: { width: 400 }
        }
    }
  ]


export const forms = {
    users,
    article,
    student,
    teacher,
    manager,
    college,
    specialty,
    course,
    question_bank,
    exam_paper
}